package com.zr.gdms.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.zr.gdms.service.CourseService;
import com.zr.gdms.serviceimpl.CourseServiceImpl;

public class UpdateCourseControllerZYH extends HttpServlet{
	CourseService cs = new CourseServiceImpl();
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		doPost(req, resp);
	}
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		int appid = Integer.parseInt(req.getParameter("aid"));
		String appcontent = req.getParameter("acontent");
		String appstate = req.getParameter("appstate");
		PrintWriter pw = resp.getWriter();
		if(appstate.equals("false")||appstate.equals("审核中")){
			boolean bl = cs.UpdateCourseByAppid(appid, appcontent);
			if(bl == true){
				pw.write("1");
			}else{
				pw.write("2");
			}
		}else if (appstate.equals("true")){
			pw.write("0");
		}
		pw.flush();
		pw.close();
	}
}
